package com.uzai.console.web.sop;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.sop.addfanchannel.AddFanChannelDto;
import com.uzai.console.dto.sop.addfanchannel.AddFanChannelIdDto;
import com.uzai.console.dto.sop.addfanchannel.AddFanChannelQuery;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.sop.AddFanChannelService;
import com.uzai.console.vo.sop.addfanchannel.AddFanChannelVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 进粉渠道
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "进粉渠道",tags = "SOP任务|进粉渠道")
@ApiSort(31)
@RestController
public class AddFanChannelController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(AddFanChannelController.class);

    @Autowired
    private AddFanChannelService addFanChannelService;

    @ApiOperation(value = "分页查询进粉渠道列表", notes = "分页查询进粉渠道列表", response = AddFanChannelVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/addFanChannel/findByPage")
    public Object findAddFanChannelPage(@RequestBody AddFanChannelQuery addFanChannelQuery){
        return addFanChannelService.findByPage(addFanChannelQuery);
    }

    @ApiOperation(value = "查询进粉渠道详情", notes = "查询进粉渠道详情", response = AddFanChannelVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/addFanChannel/findById")
    public Object findAddFanChannel(@RequestBody AddFanChannelIdDto addFanChannelIdDto){
        return addFanChannelService.findById(addFanChannelIdDto);
    }


    @SystemLogType(model = SystemModelEnum.AddFanChannel, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "添加进粉渠道", notes = "添加进粉渠道")
    @ApiOperationSupport(order = 4)
    @PostMapping("/addFanChannel/add")
    public Object addAddFanChannel(@RequestBody AddFanChannelDto addFanChannelDto){
        addFanChannelService.addAddFanChannel(addFanChannelDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.AddFanChannel, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除进粉渠道", notes = "删除进粉渠道")
    @ApiOperationSupport(order = 3)
    @PostMapping("/addFanChannel/delete")
    public Object deleteAddFanChannel(@RequestBody AddFanChannelIdDto addFanChannelIdDto){
        addFanChannelService.deleteAddFanChannel(addFanChannelIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.AddFanChannel, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "修改进粉渠道", notes = "修改进粉渠道")
    @ApiOperationSupport(order = 4)
    @PostMapping("/addFanChannel/update")
    public Object updateAddFanChannel(@RequestBody AddFanChannelDto addFanChannelDto){
        addFanChannelService.updateAddFanChannel(addFanChannelDto);
        return true;
    }

}
